package com.sz.biz.common.approval;

import java.util.List;

/**
 * Package: com.sz.biz.common.approval <br>
 * Function: TODO: ADD FUNCTION <br>
 * Author: Charles. <br>
 * Date: 2017-04-17 15:03:00.
 */
public interface ApprovalService {

    String ENTITY_TYPE_SERVICE = "biz.service";
    String ENTITY_TYPE_PRICE = "biz.price";
    String ENTITY_TYPE_PRODUCT = "biz.product";
    String ENTITY_TYPE_FINANCIAL = "biz.financial";

    /**
     *
     * @param entityType
     * @param entityId
     * @param current
     * @param next
     * @param opinion
     * @param approvedBy
     */
    void approval(String entityType, String entityId, IApprovalStatus current, IApprovalStatus next,
                  String opinion, int approvedBy);

    /**
     *
     * @param entityType
     * @param entityId
     * @return
     */
    Approval getLastApproval(String entityType, String entityId);

    /**
     *
     * @param entityType
     * @param entityId
     * @return
     */
    List<Approval> getApprovals(String entityType, String entityId);

    /**
     * 账单查看已出帐，已付款，逾期未结状态流转
     * @param entityType
     * @param entityId
     * @param billingStatus
     * @return
     */
    List<Approval> getApprovalsForBill(String entityType, String entityId, List<String> billingStatus);

    /**
     * @param entityIds
     * @param entityType
     * @return
     */
    List<Approval> getLastApprovals(String entityType, List<String> entityIds);

    /**
     * @param approvals
     * @return
     */
    List<String> formatOpinions(List<Approval> approvals);

    /**
     * 获取 action 名称
     * @param template  --审核状态模板类对象，仅使用状态类型，具体状态值不影响结果
     * @param approval  --审核实体对象
     * @return
     */
    String getActionName(IApprovalStatus template, Approval approval);

    void addApproval(Approval approval);
}
